package com.hzit.user.service.impl;

import com.hzit.user.entity.User;
import com.hzit.user.mapper.UserMapper;
import com.hzit.user.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author wf
 * @since 2024-10-10
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

	/**
	 * 1. 添加用户
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void insert() {

		User user = new User();
		user.setUsername("张三");
		user.setPassword("123");
		user.setCreated(LocalDateTime.now());
		user.setUpdated(LocalDateTime.now());
		this.save(user);

		int i = 10 / 0;

	}
}
